import { MidwayConfig } from '@midwayjs/core';
import { User } from '../entity/User';

export default {
  typeorm: {
    dataSource: {
      default: {
        type: 'mysql',
        host: 'localhost',
        port: 3306,
        username: 'root',
        password: 'root',
        database: 'booksys',
        synchronize: true, // 在开发环境下可以设置为 true，生产环境下建议设置为 false
        logging: false,
        entities: [User],
        // entities: [
        //   join(__dirname, '/../entity/*.ts') 
        // ],
        driver: require('mysql2'), // 添加这一行
      },
    },
  },
} as MidwayConfig;